<template>
  <div class="relatedInformation">
    <div
      class="careful"
      v-for="(item, index) in list"
      @click="onJump(item)"
      :key="index"
    >
      <div class="pictureCss" v-if="item.buildingImages.length == 0">
        <PublicImage
          v-if="!item.logo"
          :src="require('@/assets/image/finance/product_dj.png')"
          class="img"
        ></PublicImage>
      </div>
      <div class="pictureCss" v-else-if="item.buildingImages.length <= 1">
        <PublicImage
          v-if="item.buildingVideo"
          :src="item.videoCover"
          class="img"
        ></PublicImage>
        <PublicImage
          v-else
          v-for="(itemr, indexr) in item.buildingImages"
          :key="indexr"
          :src="itemr"
          class="img"
        ></PublicImage>
      </div>
      <div class="pictureCss" v-else>
        <PublicImage
          v-if="item.buildingVideo"
          :src="item.videoCover"
          class="img"
        ></PublicImage>
        <PublicImage
          v-else
          :src="item.buildingImages[0] || item.buildingImages[1]"
          class="img"
        ></PublicImage>
      </div>
      <div class="photocopy">
        <div class="building_Information">
          <div class="DaxiaName ellipsis">{{ item.buildingName }}</div>
          <div class="option ellipsis">{{ item.address }}</div>
          <div class="option">{{ item.Grade }}</div>
          <div v-if="item.floorType != 1 && item.floorType" class="option">
            地上{{ item.aboveGroundFloors }}层<span style="margin: 0 10px"
              >地下{{ item.undergroundFloors }}层</span
            >楼高{{ item.buildingHeight }}米
          </div>
          <div v-if="item.floorType == 1 && item.floorType" class="option">
            单层{{ item.buildingFloor }}层
          </div>
        </div>
        <div class="many">
          <div class="multiple_Choice" v-show="item.industryType">
            <div class="Choice_Name">{{ item.industryType }}</div>
          </div>
          <div class="multiple_Choice" v-show="item.buildingType">
            <div class="Choice_Name">{{ item.buildingType }}</div>
          </div>
          <div class="multiple_Choice" v-show="item.buildingDecorationType">
            <div class="Choice_Name">{{ item.buildingDecorationType }}</div>
          </div>
          <div class="multiple_Choice" v-show="item.canRegister == '可注册'">
            <div class="Choice_Name">{{ item.canRegister }}</div>
          </div>
          <div class="multiple_Choice" v-show="item.relatedPoliciesNum > 0">
            <div class="Choice_Name">政策扶持</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: [],
    },
  },
  methods: {
    onJump(item) {
      this.$router.push({ path: "/investment/investmentdetails", query: { id: item.id } });
      this.$emit("reset");
    },
  },
};
</script>

<style lang="scss" scoped>
.relatedInformation {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  justify-content: flex-start;
  text-align: left;
  .careful {
    border: 1px solid #cccccc;
    width: 386px;
    margin: 12px 0px;
    box-shadow: 4px 6px 2px 0px rgba(0, 19, 39, 0.06);
    border-radius: 5px;
    margin-right: 14px;
    .pictureCss {
      height: 202px;

      // border: 1px solid red;
      .img {
        height: 200px;
        width: 100%;
        border-radius: 4px 4px 0px 0px;
        object-fit: cover;
      }
    }
    .photocopy {
      // box-shadow: 4px 6px 0px rgba(0, 19, 39, 0.06);
    }
    .building_Information {
      font-size: 14px;
      color: #999999;
      display: flex;
      padding: 10px;
      flex-direction: column;
      align-items: flex-start;
      font-family: Microsoft YaHei, Microsoft YaHei-Regular;
      font-weight: 400;

      .DaxiaName {
        width: 100%;
        margin: 10px 0px;
        color: #333333;
        font-size: 18px;
        font-weight: bold;
        font-family: Source Han Sans CN, Source Han Sans CN-Bold;
      }
      .option {
        width: 100%;
        margin-bottom: 10px;
      }
      .option:last-of-type {
        margin-bottom: 0px;
      }
    }
    .many {
      display: flex;
      font-size: 14px;
      font-weight: 400;
      color: #045db9;
      padding: 0px 10px 10px 10px;
      // justify-content: space-between;
      // width: 300px;
      font-family: Microsoft YaHei, Microsoft YaHei-Regular;
      .multiple_Choice {
        width: 87px;
        height: 30px;
        border-radius: 3px;
        background-color: #f1f2f4;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 2px;
        .Choice_Name {
          display: flex;
          // align-items: center;
          justify-content: center;
          overflow: hidden;
          line-height: 30px;
          height: 30px;
        }
      }
    }
  }
}
</style>